package net.gdface.bean;

import android.util.Log;

import com.alibaba.fastjson.JSONObject;

import net.gdface.utils.CoreDebugLog;
import net.gdface.utils.SimpleLog;

import org.junit.Test;
import static org.junit.Assert.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static net.gdface.bean.BeanPropertySupport.BEAN_SUPPORT;

public class BeanSupportTest {
    private static final Logger logger = LoggerFactory.getLogger(BeanSupportTest.class);

    @Test
    public void test(){
        try{
            CoreDebugLog log = new CoreDebugLog();
            log.enableAndroidLog("CORE_DEBUG");
            JSONObject jsonObject = new JSONObject().fluentPut("hello","world");
            String className = BEAN_SUPPORT.getClass().getName();
            logger.info("className {}",className);
            Object value = BEAN_SUPPORT.getProperty(jsonObject, "hello");
            assertTrue("world".equals(value));
            logger.info("value {}",value);
            log.log("value {}",value);
            SimpleLog.log("value {}",value);
        }catch (Throwable e){
            e.printStackTrace();
            Log.e("test",Log.getStackTraceString(e));
            logger.info(e.getMessage(),e);
            assertTrue(false);
        }


    }
}
